﻿@using Common
@model Param_VipLevel


<link href="https://cdn.staticfile.org/layui/2.7.6/css/layui.css" rel="stylesheet">
<link rel="stylesheet" href="/Content/layuiadmin/style/admin.css" media="all">
<style>
    .layui-form-label {
        position: absolute;
        width: 90px;
        height: 20px;
    }
</style>
<div class="layui-fluid">
    <div class="layui-container">
        <div class="layui-row">
            <div class="layui-col-xs10 layui-col-xs-offset1">
                <form class="layui-form" lay-filter="form" style="margin-right:60px;" onsubmit="return false">
                    <div class="layui-form-item">
                        <label for="VipName" class="layui-form-label">超级会员名称</label>
                        <div class="layui-input-block">
                            <input type="text" name="vipname" id="VipName" required lay-verify="required" placeholder="请输入超级会员名称" value="@Model.VipName" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label for="VipPrice" class="layui-form-label">超级会员价格</label>
                        <div class="layui-input-block">
                            <input type="text" name="vipprice" id="VipPrice" lay-verify="required" placeholder="请输入超级会员价格" value="@Model.VipPrice" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label for="VipDay" class="layui-form-label">超级会员天数</label>
                        <div class="layui-input-block">
                            <input type="text" name="vipday" id="VipDay" required lay-verify="required" placeholder="请输入超级会员天数" value="@Model.VipDay" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label for="VStorageNum" class="layui-form-label">保存简历份数</label>
                        <div class="layui-input-block">
                            <input type="text" name="vstoragenum" id="VStorageNum" required lay-verify="required" placeholder="请输入保存简历份数" value="@Model.VStorageNum" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <button class="layui-btn sub" lay-submit lay-filter="formDemo">立即提交</button>
                            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<script src="https://cdn.staticfile.org/layui/2.7.6/layui.js"></script>

<script>
    layui.config({
        base: '/Content/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'set']);
</script>

<script src="~/Scripts/jquery-3.3.1.min.js"></script>
<script src="~/Scripts/dist/html5ImgCompress.min.js"></script>
<script src="~/Scripts/tools.js"></script>
<script>
    var data = {};
    //Demo
    $(function () {
        var form = layui.form;
        var upload = layui.upload;

        form.on('submit(form)', function () {
            // 验证均通过后的操作（如 Ajax 提交）
            // …
            var index = layer.load(1, { shade: [0.6, "#fff"] });
            data.VipName = $("#VipName").val();
            data.VipPrice = $("#VipPrice").val();
            data.VipDay = $("#VipDay").val();
            data.VStorageNum = $("#VStorageNum").val();
            console.log(data);

            $.post(apiurl + "api/VipLevel/Update/" +@Model.LevelID, data, function (res) {
                console.log(res);
                if (res.Code == 200) {
                    setTimeout(() => {
                        layer.close(index);
                        layer.msg("编辑成功", { icon: 6, time: 1500 });
                        setTimeout(() => {
                            parent.layer.close(parent.layer.getFrameIndex(window.name));
                            parent.location.reload();
                        }, 600)
                    }, 300);
                }
                else {
                    layer.msg("编辑失败");
                }
            })
        });
    })
</script>